package abc.secgroup.music_backend.entity;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(name = "t_album")
public class AlbumDO extends ResourceDO{

    //全局唯一ID
    @Column(name="guid")
    private String guid;

    //专辑名称
    @Column(name="alb_name")
    private String name;

    //专辑信息
    @Column(name="alb_info",columnDefinition = "TEXT")
    private String info;

    //专辑包含的歌手
    @ManyToMany(targetEntity = SingerDO.class,cascade = CascadeType.ALL)
    @JoinTable(name="t_album_singer",
            joinColumns = {@JoinColumn(name="singer_id",referencedColumnName = "guid")},
            inverseJoinColumns = {@JoinColumn(name="alb_id",referencedColumnName = "guid")})
    private Set<SingerDO> singerSet;


    //专辑包含的歌曲
    @OneToMany(mappedBy = "album",cascade = CascadeType.ALL)
    private Set<RepositoryDO> repositorySet;

    public String getGuid() {
        return guid;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public Set<SingerDO> getSingerSet() {
        return singerSet;
    }

    public void setSingerSet(Set<SingerDO> singerSet) {
        this.singerSet = singerSet;
    }

    public Set<RepositoryDO> getRepositorySet() {
        return repositorySet;
    }

    public void setRepositorySet(Set<RepositoryDO> repositorySet) {
        this.repositorySet = repositorySet;
    }
}
